package com.btl.component.crypto.handler;

import com.btl.boot.core.dto.response.R;
import com.btl.component.crypto.exception.DecryptException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class CryptExceptionHandler {

    /**
     * 解密异常处理
     *
     * @return <Void>
     */
    @ExceptionHandler(DecryptException.class)
    @ResponseStatus(HttpStatus.OK)
    public R<Void> handleSaTokenException(Exception e) {
        log.error("解密异常", e);
        return R.fail(e.getMessage());
    }

}
